<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
	pageEncoding="ISO-8859-1"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<title>Projects List</title>
<script src="js/1.7.1jquery.min.js"></script>

<link rel="stylesheet" href="css/jquery.ui.base.css" />
<link rel="stylesheet" href="css/jquery.ui.theme.css" />
<script src="js/jquery-1.9.0.js"></script>
<script src="js/jquery.ui.core.js"></script>
<script src="js/jquery.ui.widget.js"></script>
<script src="js/jquery.ui.datepicker.js"></script>
<link rel="stylesheet" href="css/demos.css" />
<script>
	$(function() {
		$(".datepicker").datepicker({
			altField : "#alternate",
			altFormat : "DD, d MM, yy"
		});
	});
</script>


<script src="js/jquery.tabSlideOut.v1.3.js"></script>
<script type="text/javascript">
	$(function() {
		$('.slide-out-div').tabSlideOut({
			tabHandle : '.handle', //class of the element that will become your tab
			pathToTabImage : 'images/takeatestdrive.png', //path to the image for the tab //Optionally can be set using css
			imageHeight : '187px', //height of tab image           //Optionally can be set using css
			imageWidth : '31px', //width of tab image            //Optionally can be set using css
			tabLocation : 'right', //side of screen where tab lives, top, right, bottom, or left
			speed : 300, //speed of animation
			action : 'click', //options: 'click' or 'hover', action to trigger animation
			topPos : '400px', //position from the top/ use if tabLocation is left or right
			rightPos : '20px', //position from left/ use if tabLocation is bottom or top
			fixedPosition : true
		//options: true makes it stick(fixed position) on scroll

		});

	});
</script>
<script type="text/javascript" language="javascript">
	$(document).ready(
			function() {
				$('.adCntnr div.acco2:eq(0)').find('div.expand:eq(0)')
						.addClass('openAd').end().find('div.collapse:gt(0)')
						.hide().end().find('div.expand').click(
								function() {
									$(this).toggleClass('openAd').siblings()
											.removeClass('openAd').end().next(
													'div.collapse')
											.slideToggle().siblings(
													'div.collapse:visible')
											.slideUp();
									return false;
								});
			})
</script>

<script>
	function selectProject(val) {
		//	alert("selectProject called");
		//alert("val="+val);
		document.getElementById("projectId").value = val;
		//alert("selectProject end");
		document.getElementById("action").value = "select";
		document.getElementById("selectProjectForm").submit();
	}

	function editProject(val) {
		//	alert("selectProject called");
		//alert("val="+val);
		document.getElementById("projectId").value = val;
		document.getElementById("action").value = "beforeEdit";
		//alert("selectProject end");
		document.getElementById("selectProjectForm").submit();
		
	}
	
	function deleteProject(val) {
		//	alert("selectProject called");
		//alert("val="+val);
		document.getElementById("projectId").value = val;
		document.getElementById("action").value = "delete";
		//alert("selectProject end");
		document.getElementById("selectProjectForm").submit();
		
	}

	</script>

</head>

<body>
	<%-- <%@ include file="/include/sessionCheck.jsp"%> --%>
	<%@ include file="/include/header.jsp"%>

	<%@ include file="/include/menu.jsp"%>

	<!--right start-->
	<div class="right_div">
		<logic:present name="projectList" scope="request">
			<br />

			<form id="selectProjectForm" action="project.do" method="post">
				<input type="hidden" name="projectId" id="projectId" /> <input
					type="hidden" name="action" id="action" value="select" /> <input
					type="hidden" name="searchType" id="searchType" value="search" />
			</form>

			<span class="head_font">Projects List</span>
			<div class="height20"></div>
			<div>
				<table border="0" cellspacing="0" cellpadding="5" width="95%"
					class="grid">
					<tr>

						<th>Project id</th>
						<th>Project name</th>
						<th>Budget</th>
						<th>Timeline</th>
						<th>Start date</th>
						<th>End date</th>
						<th>Project details</th>
						<th>Actions</th>
					</tr>
					<logic:iterate id="element" name="projectList" scope="request">
						<tr>

							<td><bean:write name="element" property="projectId" /></td>
							<td><bean:write name="element" property="projectName" /></td>
							<td><bean:write name="element" property="projectBudget" />
							</td>
							<td><bean:write name="element" property="projectTimeLine" />
							</td>
							<td><bean:write name="element" property="plannedStartDate" />
							</td>
							<td><bean:write name="element" property="plannedEndDate" />
							</td>
							<td><bean:write name="element" property="projectDetails" />
							</td>
							<td class="see_det_font"><a href="#"
								onclick='selectProject(<bean:write name="element"
									property="projectId" />)'>Select</a>&nbsp;
								<logic:present name="currentUser" scope="session">
									<logic:equal name="currentUser" property="userType"
										value="admin">
										<a href="#"
											onclick='editProject(<bean:write name="element"
									property="projectId" />)'>Update</a>&nbsp;
									<%-- <a href='#'
											onclick='deleteProject(<bean:write name="element"
											property="projectId" />)'>Delete</a> --%>
									</logic:equal>
								</logic:present></td>
						</tr>

					</logic:iterate>

				</table>

			</div>

		</logic:present>

	</div>
	<!--right end-->

	<div class="clear"></div>

	<%@ include file="/include/footer.jsp"%>

</body>
</html>
